﻿@model RedSand.Site.Models.RoleInfo
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('.dialog form .rolename').blur(function () {
            var name = $('.dialog form input[name="Name"]');
            name.val('');
            $('.dialog form .rolename').each(function () {
                name.val(name.val() + '[' + $(this).attr('lang') + ':' + $(this).val() + ']');
            });
        });
        $('.dialog form .rolename').keypress(function (event) {
            if (event.which == 13) $(this).blur();
        });
    });
</script>
<div class="dialog" title="@Html.Translate("Update")" style="width: 378px;">
    @using (Ajax.BeginForm(AdminAjaxOptions.UpdateRecord))
    {
        <div class="dialog-content">
            <div class="form-cell none-float">
                @Html.TranslateFor(model => model.Name, "Role")
                 @Html.HiddenFor(mode => mode.RoleID)
                @if (DropDownListHelper.GetLanguageList().Count() > 1)
                {
                    @Html.HiddenFor(mode => mode.Name)
                    foreach (var lang in DropDownListHelper.GetLanguageList())
                    {
                        <label style="font-weight:normal">@lang.Text</label>
                        @Html.TextBox(lang.Value + "-name", Html.Action("GetRoleName", new { name = Model.Name, language = lang.Value }), new { lang = lang.Value, style = "margin-bottom:2px", @class = "rolename", data_val = "true", data_val_required = "" })
                    }
                }
                else
                {
                    @Html.TextBoxFor(mode => mode.Name)
                }
            </div>
            <div class="form-cell">
                @Html.TranslateFor(model => model.Status)
                @Html.DropDownListFor(model => model.Status, DropDownListHelper.GetStatusList(false))
            </div>
            <div class="clear">
            </div>
        </div>
        <div class="dialog-footer">
            <input type="submit" value="@Html.Translate("Save")"/>
            <input type="button" value="@Html.Translate("Cancel")" onclick="closeDialog('.dialog')" />
        </div>
    }
</div>
